
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户删除</title>
    <%--  配置基础路径 http://localhost:8080/eshop. --%>
    <%
        String basePath = request.getScheme() + "://" + request.getServerName() + ":"+
                request.getServerPort() +request.getContextPath()+ "/";
    %>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="static/layui/css/layui.css">
    <script src="static/layui/layui.js"></script>
</head>
<body>
<br>
<br>
<form class="layui-form" action="">
    <input type="hidden" name="id" value="${user.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">账号：</label>
        <div class="layui-input-inline">
            <input type="text" name="username" value="${user.username}" required  lay-verify="required" placeholder="请输入新的账号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码：</label>
        <div class="layui-input-inline">
            <input type="password" name="password" value="${user.password}" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">type：</label>
        <div class="layui-input-inline">
            <select name="type" lay-verify="required">
                <option value=""></option>
                <option value="0" ${user.type eq 0?'selected':''}>管理员</option>
                <option value="1" ${user.type eq 1?'selected':''}>普通用户</option>
            </select>
        </div>
    </div>
    <%----%>
    <div class="layui-form-item">
        <label class="layui-form-label">头像：</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn" id="test1">
                <i class="layui-icon">&#xe67c;</i>
            </button>
            <img src="http://localhost:8080/upload/${user.userimg}" style="width: 80px;height: 80px;border-radius: 50%" id="img">
        </div>
        <input type="hidden" name="imgNmame" id="userImg">
    </div>
    <%----%>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">确认删除</button>
            <button class="layui-btn layui-btn-primary" onclick="clo()">取消</button>
        </div>
    </div>
</form>
</body>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        var $ = layui.$;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            $.post("user.do?method=cleanUp",data.field,function (){
            });

            window.setTimeout(clo);
            return false;//false取消提交，true执行提交
        });
    });

    function clo() {
        console.log("ok");
        //调用父页面load方法
        parent.load("user.do?method=findPage");
        //通过父页面关闭当前页面
        var index = parent.layer.getFrameIndex(window.name);
        //得到当前iframe层的索引
        parent.layer.close(index);
    }

</script>
</html>
